package com.zidongxiangxi.rabbit.producer.entity;

import com.alibaba.fastjson.JSON;

/**
 * RabbitMQ关联id
 *
 * @author chenxudong
 * @date 2020/11/07
 */
public class RabbitCorrelationId {
	/**
	 * 应用名
	 */
	private String application;

	/**
	 * 消息id
	 */
	private String messageId;

	public RabbitCorrelationId() {}

	public RabbitCorrelationId(String application, String messageId) {
		this.application = application;
		this.messageId = messageId;
	}

	public static RabbitCorrelationId parseRabbitCorrelationId(String content) {
		RabbitCorrelationId id = null;
		try {
			id = JSON.parseObject(content, RabbitCorrelationId.class);
		} catch (Throwable ignore) {}
		return id;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}

	public String getApplication() {
		return application;
	}

	public void setApplication(String application) {
		this.application = application;
	}

	public String getMessageId() {
		return messageId;
	}

	public void setMessageId(String messageId) {
		this.messageId = messageId;
	}
}
